#!/usr/bin/make -f

export DH_VERBOSE=1
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

bindir = usr/bin

libdir18 = $(shell ruby1.8 -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
archdir18 = $(shell ruby1.8 -r rbconfig -e 'print Config::CONFIG["archdir"]')
#libdir19 = $(shell ruby1.9 -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
#archdir19 = $(shell ruby1.9 -r rbconfig -e 'print Config::CONFIG["archdir"]')



#builddir = pkg/fakeroot
#moddir = $(shell apxs2 -q LIBEXECDIR)
#modsavailabledir = etc/apache2/mods-available
#passengermodule = usr/lib/passenger/mod_passenger.so
#admintools = passenger-memory-stats passenger-make-enterprisey passenger-status
tmpdir = $(CURDIR)/debian/tmp

DEB_DH_INSTALL_SOURCEDIR = $(tmpdir)
DEB_INSTALL_MANPAGES_libapache2-mod-passenger += man/*

clean::
	rake clean
	rm -rf $(tmpdir)

build/ohcount::
	rake


install/ohcount::
		mkdir -p $(DEB_DESTDIR)/$(bindir) $(DEB_DESTDIR)/$(archdir18)/ $(DEB_DESTDIR)/$(libdir18)/ohcount/
		cp bin/ohcount $(DEB_DESTDIR)/$(bindir)/
		cp lib/*-linux/* $(DEB_DESTDIR)/$(archdir18)/
		cp -R lib/gestalt lib/licenses lib/ohcount/ lib/ohcount.rb $(DEB_DESTDIR)/$(libdir18)/ohcount/
		sed -i -e "s|lib/|ohcount/|g" $(DEB_DESTDIR)/$(libdir18)/ohcount/gestalt/platform.rb $(DEB_DESTDIR)/$(libdir18)/ohcount/ohcount.rb

#        mkdir -p $(DEB_DESTDIR)/$(moddir)
#        mv $(DEB_DESTDIR)/$(passengermodule) $(DEB_DESTDIR)/$(moddir)
#        rm $(DEB_DESTDIR)/$(bindir)/passenger-install-apache2-module
#        mkdir -p $(DEB_DESTDIR)/$(sbindir)
#        for admintool in $(admintools); do \
#                mv $(DEB_DESTDIR)/$(bindir)/$$admintool $(DEB_DESTDIR)/$(sbindir); \
#                done;

get-orig-source:
	uscan --force-download
